package com.maxie.factory.abstractfactory.store.impl;

import com.maxie.factory.abstractfactory.entity.CNPizza;
import com.maxie.factory.abstractfactory.entity.Pizza;
import com.maxie.factory.abstractfactory.entity.USAPizza;
import com.maxie.factory.abstractfactory.entity.ingredient.factory.impl.CNPizzaIntegredFactory;
import com.maxie.factory.abstractfactory.store.PizzaStore;

public class CNPizzaStore extends PizzaStore {
    @Override
    public Pizza createPizza(String type) {

        // pizza商店设置原料厂，创建pizza对象时，将原料工厂传入，pizza使用原料
        CNPizzaIntegredFactory cnPizzaIntegredFactory = new CNPizzaIntegredFactory();
        if (type == "cn") {
            return new CNPizza(cnPizzaIntegredFactory);
        } else if (type == "usa") {
            return new USAPizza();
        }
        return null;
    }
}
